<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="utf-8"%>
<html>
 <body>
 <%@ include file="dengluPublic.jsp" %>
    <%
    request.setCharacterEncoding("utf-8");
    String cno=request.getParameter("cno");
    String fno=request.getParameter("fno");
    System.out.println(">>>>"+cno+","+fno+"<<<<<<<<");
    
     %>
     <% String driverClass1="com.mysql.jdbc.Driver";
	    String url1="jdbc:mysql://localhost:3306/vote?useSSL=false";
	    String user1="root";
	    String password1="womenilu2580";	    
	    
	    Class.forName(driverClass1);
	    Connection conn=DriverManager.getConnection(url1,user1,password1);	 
	    Statement stat=conn.createStatement();
	    String sql="select * from xiaoxi where cno='"+cno+"' and fno='"+fno+"'";
	    ResultSet rs=stat.executeQuery(sql);
	    if(rs.next())
	    {
	    	Class.forName(driverClass1);
		    Connection conn1=DriverManager.getConnection(url1,user1,password1);	 
		    Statement stat1=conn1.createStatement();
		    String sql1="delete from xiaoxi where cno='"+cno+"' and fno='"+fno+"'";
		    stat1.executeUpdate(sql1);
	    }
	    
	    Class.forName(driverClass1);
	    Connection conn3=DriverManager.getConnection(url1,user1,password1);	 
	    Statement stat3=conn3.createStatement();
	    String sql3="select * from xiaoxi where cno='"+fno+"' and fno='"+cno+"'";
	    ResultSet rs3=stat3.executeQuery(sql3);
	    if(rs3.next())
	    {
		    Class.forName(driverClass1);	 
		    Connection conn2=DriverManager.getConnection(url1,user1,password1);	 
		    Statement stat2=conn2.createStatement();
		    String sql2="delete from xiaoxi where cno='"+fno+"' and fno='"+cno+"'";
		    stat2.executeUpdate(sql2);
		}
	     
	   %> 
    <%
    response.sendRedirect("sciencechat.jsp");
     %>
    
  </body>
</html>
